import 'package:cbec_app/entity/home/content/content_data.dart';
import 'package:cbec_app/generated/json/base/json_field.dart';
import 'package:cbec_app/generated/json/cateslide_group_entity.g.dart';
import 'dart:convert';
export 'package:cbec_app/generated/json/cateslide_group_entity.g.dart';

@JsonSerializable()
class CateslideGroupEntity extends ContentData {
  @JSONField(name: "title_color2")
  String? titleColor2 = '';
  @JSONField(name: "goods_lr")
  int? goodsLr = 0;
  @JSONField(name: "display_scale")
  String? displayScale = '';
  int? rdx = 0;
  @JSONField(name: "text_align_type")
  String? textAlignType = '';
  @JSONField(name: "bg_image")
  CateslideGroupBgImage? bgImage;
  String? uuid = '';
  @JSONField(name: "bg_color2")
  String? bgColor2 = '';
  @JSONField(name: "txt_mod_2")
  String? txtMod2 = '';
  @JSONField(name: "txt_mod_1")
  String? txtMod1 = '';
  @JSONField(name: "page_margin_right")
  int? pageMarginRight = 0;
  @JSONField(name: "goods_inerlr")
  int? goodsInerlr = 0;
  @JSONField(name: "sub_entry")
  List<CateslideGroupSubEntry>? subEntry = [];
  int? per = 0;
  @JSONField(name: "size_a")
  int? sizeA = 0;
  @JSONField(name: "page_margin_bottom")
  int? pageMarginBottom = 0;
  @JSONField(name: "title_bgcolor")
  String? titleBgcolor = '';
  int? imgw = 0;
  @JSONField(name: "sub_a")
  int? subA = 0;
  @JSONField(name: "border_radius_type")
  String? borderRadiusType = '';
  @JSONField(name: "goods_inertb")
  int? goodsInertb = 0;
  int? size = 0;
  @JSONField(name: "show_title")
  bool? showTitle = false;
  @JSONField(name: "image_style2")
  String? imageStyle2 = '';
  @JSONField(name: "goods_top2")
  int? goodsTop2 = 0;
  @JSONField(name: "page_margin_top")
  int? pageMarginTop = 0;
  @JSONField(name: "title_size")
  String? titleSize = '';
  @JSONField(name: "image_fill_style")
  String? imageFillStyle = '';
  int? scale = 0;
  @JSONField(name: "box_shadowcolor")
  String? boxShadowcolor = '';
  @JSONField(name: "text_style_type")
  String? textStyleType = '';
  @JSONField(name: "tip_bgcolor")
  String? tipBgcolor = '';
  @JSONField(name: "image_style")
  String? imageStyle = '';
  @JSONField(name: "tip_pos")
  int? tipPos = 0;
  @JSONField(name: "title_color")
  String? titleColor = '';
  @JSONField(name: "bg_opcolor")
  String? bgOpcolor = '';
  @JSONField(name: "btn_rdx")
  int? btnRdx = 0;
  String? primod = '';
  @JSONField(name: "goods_margin")
  int? goodsMargin = 0;
  @JSONField(name: "page_margin_left")
  int? pageMarginLeft = 0;
  @JSONField(name: "goods_bottom")
  int? goodsBottom = 0;
  @JSONField(name: "bg_color")
  String? bgColor = '';
  @JSONField(name: "goods_bottom2")
  int? goodsBottom2 = 0;
  @JSONField(name: "radius_num")
  int? radiusNum = 0;
  @JSONField(name: "page_margin_iner")
  int? pageMarginIner = 0;
  @JSONField(name: "box_shadowcolor2")
  String? boxShadowcolor2 = '';
  @JSONField(name: "show_zz")
  bool? showZz = false;
  @JSONField(name: "slide_setting")
  String? slideSetting = '';
  @JSONField(name: "show_bd")
  bool? showBd = false;
  @JSONField(name: "tip_bgcolorend")
  String? tipBgcolorend = '';

  CateslideGroupEntity() {
    type = 'cateslide'; // 直接在构造函数中赋值
  }

  factory CateslideGroupEntity.fromJson(Map<String, dynamic> json) => $CateslideGroupEntityFromJson(json);

  @override
  Map<String, dynamic> toJson() => $CateslideGroupEntityToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }

  @override
  ContentData fromJson(Map<String, dynamic> json) {
    return CateslideGroupEntity.fromJson(json);
  }
}

@JsonSerializable()
class CateslideGroupBgImage {
  @JSONField(name: "attachment_url")
  String? attachmentUrl = '';

  CateslideGroupBgImage();

  factory CateslideGroupBgImage.fromJson(Map<String, dynamic> json) => $CateslideGroupBgImageFromJson(json);

  Map<String, dynamic> toJson() => $CateslideGroupBgImageToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}

@JsonSerializable()
class CateslideGroupSubEntry {
  @JSONField(name: "link_type")
  String? linkType = '';
  @JSONField(name: "image_url")
  String? imageUrl = '';
  @JSONField(name: "link_title")
  String? linkTitle = '';
  String? title = '';
  @JSONField(name: "link_id")
  int? linkId = 0;
  String? desc = '';

  CateslideGroupSubEntry();

  factory CateslideGroupSubEntry.fromJson(Map<String, dynamic> json) => $CateslideGroupSubEntryFromJson(json);

  Map<String, dynamic> toJson() => $CateslideGroupSubEntryToJson(this);

  @override
  String toString() {
    return jsonEncode(this);
  }
}
